package top.tagao.service_oss.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import top.tagao.service_oss.service.FileService;
import top.tagao.yygh.common.result.Result;

/**
 * @author fu-xiao-liu
 * @Date 2022/3/12 10:46
 */

@Api(tags = "阿里云Oss服务")
@RestController
@RequestMapping("/api/oss/file")
public class FileAPIController {

    @Autowired
    private FileService fileService;

    @ApiOperation("图片上传OSS")
    @PostMapping("fileUpload")
    public Result fileUpload(MultipartFile file) {
        //获取上传文件
        String url = fileService.upload(file);
        return Result.ok(url);
    }


}
